<template>
  <nav class="menu">
    <router-link class="menu-item" v-for="item in menuList" :key="item.text" :to="{ name: item.pathname }">{{ item.text
    }}</router-link>
  </nav>
</template>

<script>
export default {
  data() {
    return {
      menuMap: {
        //生产管理
        "category": [
          {
            pathname: "b1",
            text: "为你推荐",
          },
          {
            pathname: "b2",
            text: "床品床垫",
          },
          {
            pathname: "b3",
            text: "鞋包配饰",
          },
          {
            pathname: "b4",
            text: "休闲零食",
          },
          {
            pathname: "b5",
            text: "家庭清洁",
          },
          {
            pathname: "b6",
            text: "母婴亲子",
          },
          {
            pathname: "b7",
            text: "运动旅行",
          },
          {
            pathname: "b8",
            text: "数码家电",
          },
          {
            pathname: "b9",
            text: "宠物生活",
          },
        ],
      },
    };
  },
  computed: {
    menuList() {
      return this.menuMap[this.$route.matched[1].meta.title];
    },
  },
  created() {
    // console.log(this.menuList);
  },
};

</script>

<style scoped>
.menu {
  width: 81px;
  padding: 20px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.menu-item {
  padding: 10px 0;
}
</style>